package com.crazymaker.springcloud.cloud.center.zuul.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.concurrent.Executors;

@RestController
@RequestMapping("/demo2")
@Slf4j
@Api("demo2控制器")
public class Demo2Controller {
    @RequestMapping("/test")
    @ApiOperation("test方法")
    public String test(HttpServletRequest request) {
        Executors.newFixedThreadPool(1).submit(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(10000);
                    log.info("username = {}", request.getParameter("username"));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
        log.info("username = {}", request.getParameter("username"));
        return "hello world";
    }
}
